package com.wangyang.anno;

import com.wangyang.validation.StateValidated;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Documented  //元注解
@Target({FIELD})  //元注解
@Retention(RUNTIME)  //元注解
@Constraint(validatedBy = {StateValidated.class})  //校验规则所在的类字节码文件
public @interface State {
    //校验失败的提示信息
    String message() default "{state的值只能是草稿或已发布}";
    //分组相关
    Class<?>[] groups() default { };
    //负载
    Class<? extends Payload>[] payload() default { };
}
